<template>
  <popup class="login-popup" v-model="visible" title="立即体验">
    <login-form @click-login="handleLogin" @click-code="handleGetCode" @click-gift="$emit('click-gift')"/>
  </popup>
</template>

<script>
import Popup from '@/components/popup-box';
import LoginForm from '@/components/login-form';

export default {
  props: {
    value: Boolean
  },
  components: {
    Popup,
    LoginForm
  },
  data() {
    return {
      visible: this.value
    };
  },
  watch: {
    value(val) {
      this.visible = val;
    },
    visible(val) {
      this.$emit('input', val);
    }
  },
  methods: {
    handleLogin(form) {
      this.$emit('click-login', form);
    },
    handleGetCode(form) {
      this.$emit('click-code', form);
    }
  }
};
</script>
